﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NLBS.Data.Interface;
using NLBS.Entity;
namespace NLBS.Data.SqlDataService
{
   public class ArticleService:IArticleService
    {
        #region IArticleService Members

       private DbProvider db
       {
           get
           {
               return DbProvider.Instance();
           }
       }

        public IList<Article> GetArticle()
        {
            return db.GetArticle();
        }

        public IList<ArticleLink> GetPreviousAndNextArticle(int articleID)
        {
            return db.GetPreviousAndNextArticle(articleID);
        }

        public IList<Article> GetTopArticle(int topCount)
        {
            return db.GetTopArticle(topCount);
        }

        public IPagedCollection<Article> GetArticleByUserID(int startIndex, int pageSize, int userID)
        {
            return db.GetArticleByUserID(startIndex, pageSize, userID);
        }

        public IPagedCollection<Article> GetAllArticleByPage(int startIndex, int pageSize)
        {
            return db.GetAllArticleByPage(startIndex, pageSize);
        }

        public IPagedCollection<Article> GetRssArticleByPage(int pageSize)
        {
            return db.GetRssArticleByPage(pageSize);
        }

        public IPagedCollection<Article> GetCatArticleByPage(int startIndex, int pageSize, int catID)
        {
            return db.GetCatArticleByPage(startIndex, pageSize, catID);
        }

        public IPagedCollection<Article> GetSelectedArticleByPage(int startIndex, int pageSize)
        {
            return db.GetSelectedArticleByPage(startIndex, pageSize);
        }

        public Article GetArticleByID(int articleID)
        {
            return db.GetArticleByID(articleID);
        }

        public int InsertArticle(Article item)
        {
            return db.InsertArticle(item);
        }

        public void UpdateArticle(Article item)
        {
             db.UpdateArticle(item);
        }

        public void UpdateArticleViewCount(int articleId)
        {
            db.UpdateArticleViewCount(articleId);
        }

        public void DeleteArticle(int articleID)
        {
            db.DeleteArticle(articleID);
        }

        public int GetArticleCategoryCount(int catID)
        {
            return db.GetArticleCategoryCount(catID);
        }

        public IPagedCollection<Article> GetPagedArticleByMonth(int startIndex, int pageSize, int year, int month)
        {
            return db.GetPagedArticleByMonth(startIndex, pageSize, year, month);
        }

        public IPagedCollection<Article> GetPagedArticleByYear(int startIndex, int pageSize, int year)
        {
            return db.GetPagedArticleByYear(startIndex, pageSize, year);
        }

        public IPagedCollection<Article> GetPagedArticleByDay(int startIndex, int pageSize, DateTime date)
        {
            return db.GetPagedArticleByDay(startIndex, pageSize, date);
        }

        public IList<Archive> GetArticleMonthArchive()
        {
            return db.GetArticleMonthArchive();
        }

        public IList<Article> GetAllArticleByMonth(int year, int month)
        {
            return db.GetAllArticleByMonth(year, month);
        }

        public IPagedCollection<Article> GetPagedArticleBySearch(int startIndex, int pageSize, string prefix)
        {
            return db.GetPagedArticleBySearch(startIndex, pageSize, prefix);
        }

        public void UpdateArticleCount(int oldCatID, int catID, int authorID)
        {
            db.UpdateArticleCount(oldCatID, catID, authorID);
        }

        #endregion
    }
}
